/*
 * @Description:
 * @Author: 胡涛
 * @Date: 2023-10-22 01:01:19
 * @LastEditors: 胡涛
 * @LastEditTime: 2023-10-22 01:12:34
 */
import api from "@/api";
import {
  GetPermissionsInputDto,
  SavePermissionsInputDto,
  GetPermissionListResultDto,
} from "./types";

export default {
  /**
   * 获取权限数据
   * @param id
   * @param data
   * @returns
   */
  getPermissions(
    input: GetPermissionsInputDto
  ): Promise<GetPermissionListResultDto> {
    return api.get("/api/permission-management/permissions", input);
  },
  /**
   * 保存权限配置
   */
  savePermissions(input: SavePermissionsInputDto): Promise<any> {
    let params = {
      providerKey: input.providerKey,
      providerName: input.providerName,
    };
    let data = { permissions: input.permissions };
    return api.put("/api/permission-management/permissions", data, { params });
  },
};
